#!/bin/bash

mapfile -t array <<< $(cat ./repository.manifest | jq '.directories | to_entries[] | {repo_name: (.key | sub("/"; "."; "g")), clone_addr: .value.git_checkout.repo_url, mirror: true}' | jq -c -r '.')

for element in "${array[@]:1}"
do
    echo "$element"
    curl -X 'POST' \
         '127.0.0.1:3000/api/v1/repos/migrate?token=66c64f1c6a0dbf416f83d22c9b737f0ca11f8a93' \
         -H 'accept: application/json' \
         -H 'Content-Type: application/json' \
         -d "$element"
done
